#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 1e7 + 10;

int primes[N], cnt;
bool st[N];
LL s[N];
int phi[N];

void init(int n){
    for(int i = 2; i <= n; i ++){
        if(!st[i]){
            primes[cnt ++] = i;
            phi[i] = i - 1;
        }

        for(int j = 0; primes[j] <= n / i; j ++){
            st[i * primes[j]] = true;
            if(i % primes[j] == 0){
                phi[i * primes[j]] = phi[i] * primes[j];
                break;
            }
            phi[i * primes[j]] = phi[i] * (primes[j] - 1); 
        }
    }


    for(int i = 1; i <= n; i ++){
        s[i] = phi[i] + s[i - 1];
    }
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    
    int n;
    cin >> n;init(n);

    LL res = 0;
    for(int i = 0; i < cnt; i ++){
        int p = primes[i];
        res += s[n / p] * 2 + 1;
    }
    cout << res;

    return 0;
}